package at.pp.match3.game.assets;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import at.pp.match3.game.render.GameAsset;

public class TextAsset extends GameAsset {

    private int color;
    private int textSize;
    private String text;
    private Paint paint;

    public TextAsset(final int positionX, final int positionY) {
        super(positionX, positionY);

        this.textSize = 20;
        this.text = "";
        color = Color.RED;

        paint = new Paint();
        // paint.setAntiAlias(true);
        paint.setTextSize(this.textSize);
        // paint.setFakeBoldText(true);
        paint.setColor(color);
    }

    @Override
    public final void render(final Canvas canvas) {
        canvas.drawText(text, 5, 25, paint);
    }

    @Override
    public void update(final long deltaTime) {

    }

    @Override
    public void select(final boolean isSelected) {

    }

    public final int getColor() {
        return color;
    }

    public final void setColor(final int color) {
        this.color = color;
        paint.setColor(color);
    }

    public final int getTextSize() {
        return textSize;
    }

    public final void setTextSize(final int textSize) {
        this.textSize = textSize;
        this.paint.setTextSize(textSize);
    }

    public final String getText() {
        return text;
    }

    public final void setText(final String text) {
        this.text = text;
    }

    public final void setTypeFace(Typeface typeFace) {
        paint.setTypeface(typeFace);
    }

}
